<template>
  <div class="leftmenu">
    <scroll class="content" :probeType="2">
      <van-sidebar v-model="active" @change="leftitemclick">
        <van-sidebar-item
          :title="item"
          v-for="(item, index) in titles"
          :key="index"
        />
      </van-sidebar>
    </scroll>
  </div>
</template>

<script>
import scroll from "@/components/common/better-scroll/scroll";
export default {
  name: "cateleftmenu",
  data() {
    return {
      active: 0,
    };
  },
  props: {
    titles: {
      type: Array,
      default() {
        return [];
      },
    },
  },
  methods: {
    leftitemclick(index) {
      this.$emit("leftitemclick", index);
      this.$bus.$emit("leftitemclick", index);
    },
  },
  components: {
    scroll,
  },
};
</script>

<style scoped>
.leftmenu {
}
/* .content {
  position: absolute;
  top: 44px;
  bottom: 44px;
  overflow: hidden;
} */
.content {
  height: calc(100vh - 88px);
}
</style>